package com.sands.network.apihelper;


import com.sands.network.helper.RetrofitHelper;
import com.sands.network.helper.RxjavaHelper;
import com.sands.network.module.UserToken;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func1;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/8/14.
 * 不带token 一般请求
 */

public class AppNormalHelper extends BaseApiHelper {


    /**
     * 微信精选
     *
     * @return pno    int	否	当前页数，默认1
     * ps	int	否	每页返回条数，最大50，默认20
     * key	string	是	应用APPKEY(应用详细页查询)
     * dtype	string	否	返回数据的格式,xml或json，默认json
     */
    public static Observable<String> normal_wx_news(int pno) {
        String json = "{\n" +
                "    \"pno\": " + pno + ",\n" +
                "    \"ps\": 30,\n" +
                "    \"dt\": \"json\"\n" +
                "}";
        return RetrofitHelper.callBaseNormalApiAccess()
                .baseApiAccess(json)
                .compose(RxjavaHelper.handleResult())
                .map(new Func1<Object, String>()
                {
                    @Override
                    public String call(Object o) {
                        return mGson.toJson(o);
                    }
                })
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());

    }

}

